/*点击不同的价钱出现不同的边框*/
let pricePicture=document.getElementsByClassName("pricePicture");
let borderPicture=document.getElementsByClassName("borderPicture");
/*点击不同的价格支付，在实际支付处显示应支付的价钱*/
/*点击不同的支付价格，显示不同的二维码*/
for(let i=0;i<pricePicture.length;i++){
    pricePicture[i].onclick=function(){
        borderPicture[i].style.display="block";
        for(let j=0;j<pricePicture.length;j++){
            if(j==i){
                continue;
            }
            borderPicture[j].style.display="none";
        }
    }
}
for(let i=0;i<borderPicture.length;i++){
    document.onclick=function(){
        borderPicture[i].style.display="none";
    }
}
/*vip充值，点击充值天，周，月，年*/
/*点击充值大会员的按钮*/
let differentTimeVip=document.getElementsByClassName("differentTimeVip");
let differentTimeVipBtn=document.getElementsByClassName("differentTimeVipBtn")[0];
// let differentTimeVipBottom=document.getElementsByClassName("differentTimeVipBottom");
let myCoinsNumber=document.getElementsByClassName("myCoinsNumber")[0];
let vipPrice=document.getElementsByClassName("VipPrice");
let FORM=document.getElementsByClassName("FORM")[0];
let cha=document.getElementsByClassName("cha")[0];
let FormE=document.getElementsByClassName("FormE");
var PayYOne=document.getElementsByClassName("PayY")[0];
PayYOne.onclick=function (){
    window.location.href="../pay/toAlipay?sn="+FormE[0].value;
    // window.location.reload();
}
differentTimeVipBtn.style.backgroundColor="#c6bdbd";
for(let i=0;i<differentTimeVip.length;i++){1
    differentTimeVip[i].onclick=function(){
        differentTimeVipBtn.style.backgroundColor="#42bbfd";
        /*这里是点击显示边框*/
        differentTimeVip[i].style.border="3px solid #fc1944";
        for(let j=0;j<differentTimeVip.length;j++) {
            if (j == i) {
                continue;
            }
            differentTimeVip[j].style.border="1px solid rgba(0,0,0,.3)";
            // console.log(date);
            differentTimeVipBtn.onclick=function(){
                FORM.style.display="block";
                $.ajax({
                    type:'post',
                    url:'../payLog/addPayLog',
                    data:{
                        order_amount:vipPrice[i].innerHTML,
                        order_status:0,
                        order_name:"可乐支付",
                        order_body:"充值会员"
                    },
                    success:function(data){
                        // console.log(data)
                        FORM[0].value=data.data.order_id;
                        FormE[2].value=vipPrice[i].innerHTML;
                    }
                });

            }
            cha.onclick=function(){
                FORM.style.display="none";
            }
        }
    }
}

// let PayY=document.getElementsByClassName("PayY")[0];
// PayY.onclick=function(){
//     window.location.href=staticPath+'../../pay/toAlipay?'+sn=${session.order.order_id};
// }
//onclick="location.href='@{../pay/toAlipay(sn=${session.order.order_id})}'"
//获取昵称
let userName=document.getElementsByClassName("userName")[0];
userName.innerHTML=sessionStorage.getItem('nickname');
//判断是否是VIP
let vipTure=document.getElementsByClassName("vipTure")[0];
if(sessionStorage.getItem('vip')=="0"){
    vipTure.style.backgroundColor="#f3f3f2";
}else{
    vipTure.style.backgroundColor="#42bbfd"
}


